#include <stdio.h>
#include <stdlib.h>

#define CAND_LEN 81

struct ballot{
    int vote;
    struct ballot *prev;
};

struct ballot *push(struct ballot *cur, int vote);

int main(int argc, char **argv){
    int i, cases, num_cand, next_vote;
    char **candidates, c;
    struct ballot *cur_ballot, *head;

#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w+", stdout);
#endif


    scanf("%d", &cases);
    while(cases--){
        cur_ballot = NULL;
        scanf("%d", &num_cand);
        candidates = (char **)malloc(sizeof(char[CAND_LEN])*num_cand);
        for(i = 0; i < num_cand; i++)
            fgets(candidates[i], CAND_LEN, stdin);
        while(1){
            while(1){
                scanf("%d%c", &next_vote, &c);
                cur_ballot = push(cur_ballot, next_vote);
                if(c=='\n') break;
            }
            if((c=getchar())=='\n')
                break;
            ungetc(c, stdin);
        }
        head = cur_ballot;
        printf("got %d candidates\n", num_cand);
    }
    return(0);
}

struct ballot *push(struct ballot *cur, int vote){
    ;
}
